/*
package com.dubbo2.lib.mq;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RocketMqSender {

    @Autowired
    RocketMQTemplate rocketMQTemplate;

    */
/**
 * 同步发送:消息发送方发出数据后，会在收到接收方发回响应之后才发下一个
 *
 * @param destination
 * @param objMsg
 * <p>
 * 发送方发出数据后，不等接收方发回响应，接着发送下个数据包的通讯方式
 * @param destination
 * @param objMsg
 * <p>
 * 只发送请求不等待应答
 * <p>
 * 延时消息
 * 延迟级别（18个等级）
 * 1到18分别对应1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
 *//*

    public void convertAndSend(String destination, Object objMsg) throws MessagingException {
        log.info("=============convertAndSend==");
        rocketMQTemplate.convertAndSend(destination, JSON.toJSONString(objMsg));
    }

    */
/**
 * 发送方发出数据后，不等接收方发回响应，接着发送下个数据包的通讯方式
 *
 * @param destination
 * @param objMsg
 *//*

    public void asyncSend(String destination, Object objMsg) throws MessagingException {
        log.info("=============asyncSend==");
        rocketMQTemplate.asyncSend(destination, JSON.toJSONString(objMsg), new SendCallback() {
            @Override
            public void onSuccess(SendResult sendResult) {
                log.info("传输成功");
                log.info(JSON.toJSONString(sendResult));
            }

            @Override
            public void onException(Throwable e) {
                log.error("传输失败", e);
            }
        });
    }

    */
/**
 * 只发送请求不等待应答
 *//*

    public void sendOneWay(String destination, Object objMsg) {
        log.info("=============sendOneWay==");
        rocketMQTemplate.sendOneWay(destination, JSON.toJSONString(objMsg));
    }


    */
/**
 * 延时消息
 * 延迟级别（18个等级）
 * 1到18分别对应1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
 *//*

    public void syncSend(String destination, Object objMsg) {
        log.info("=============syncSend==");
        Message message = MessageBuilder.withPayload(JSON.toJSONString(objMsg)).build();
        rocketMQTemplate.syncSend(destination, message, 1000, 2);
    }
}
*/
